// 对申请页面的资源(css js 图片等)路径进行处理
const pageProcessor = page => page
  .replace(/(?<=\<head>)[\s\S]+?(?=\<\/head>)/, '<link rel="stylesheet" href="/static/style.css">')
  .replace('src="img/yiliao.png"', 'src="https://xsswzx.cdu.edu.cn/ispstu/com_user/img/yiliao.png"')
  .replace(/(?<=")outcampus_ewm.asp.+?(?=")/, '/warrant')
  .replace(/images\/none\.png/g, 'https://xsswzx.cdu.edu.cn/ispstu/com_user/images/none.png')

// 对凭证页面进行同上处理
const warrantProcessor = warrant => warrant
  .replace('images/pzo.png', 'https://xsswzx.cdu.edu.cn/ispstu/com_user/images/pzo.png')
  .replace("'qrcode.min.js'", '"https://cdn.bootcdn.net/ajax/libs/qrcodejs/1.0.0/qrcode.min.js"')
  .replace('js/JsBarcode.all.min.js', 'https://cdn.bootcdn.net/ajax/libs/jsbarcode/3.11.5/JsBarcode.all.min.js')

module.exports = { pageProcessor, warrantProcessor }